@echo off
:: 设置编码为 UTF-8
chcp 65001 >nul
:: 获取当前目录
set "CURRENT_DIR=%cd%"
set "FRONTEND_DIR=%CURRENT_DIR%/gui"

set "BACKEND_DIR=%CURRENT_DIR%"

echo 注意开发环境请设置config中的development为true
echo 当前前端目录: %FRONTEND_DIR%
echo 后端目录: %BACKEND_DIR%

:: 启动前端开发服务器
start "Frontend" /D "%FRONTEND_DIR%" cmd /k "pnpm dev"

:: 等待前端服务启动
timeout /t 10 /nobreak >nul

:: 启动后端服务
if exist "%BACKEND_DIR%" (
    start "Backend" /D "%BACKEND_DIR%" cmd /k ".venv\Scripts\activate && uv run main.py"
)

echo 已启动两个终端窗口
pause